<template>
	<div>
		<el-row :gutter="24">
			<el-col :span="1" style="margin-right:0px;">
				<p class="queryLabel">入库类型:</p>
			</el-col>
			<el-col :span="4" style="margin-right: 0px;">
				<el-select size="small" v-model="carSelect.status" placeholder="请选择入库类型状态" >
					<el-option v-for="item in saleType" :label="item.label" :value="item.value"></el-option>
				</el-select>
			</el-col>
			<el-col :span="1" style="margin-right:0px;">
				<p class="queryLabel">仓库:</p>
			</el-col>
			<el-col :span="4" style="margin-right: 0px;">
				<el-select size="small" v-model="carSelect.warehouse" placeholder="请选择仓库" clearable>
					<el-option v-for="item in warehouseType" :label="item.label" :value="item.value"></el-option>
				</el-select>
			</el-col>
			<el-col :span="1" style="">
				<p class="queryLabel">车系:</p>
			</el-col>
			<el-col :span="3">
				<el-input placeholder="请选择车系" size="small" icon="search" v-model="carModelCode" :on-icon-click="handleIconClick">
				</el-input>
			</el-col>
			<el-col :span="1" style="text-align: left;">
				<p class="queryLabel">车辆型号:</p>
			</el-col>
			<el-col :span="3">
				<el-select size="small" style="width: 100%;" v-model="carSelect.carModelCode" placeholder="请选择配置" clearable @change="changeModel">
					<el-option v-for="item in modelCombo" :label="item.label" :value="item.value"></el-option>
				</el-select>
			</el-col>
			<el-col :span="1" style="">
				<p class="queryLabel">车辆配置:</p>
			</el-col>
			<el-col :span="3">
				<el-select size="small" style="width: 100%;" v-model="carSelect.carConfigureCode" placeholder="请选择配置" clearable>
					<el-option v-for="item in configCombo" :label="item.label" :value="item.value"></el-option>
				</el-select>
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="1" style="margin-right: 6px;">
				<p class="queryLabel">采购日期:</p>
			</el-col>
			<el-col :span="4">
				<el-date-picker v-model="data.firstStart" size="small" style="width:92%;" type="date" clearable placeholder="采购日期">
				</el-date-picker>
			</el-col>
			<el-col :span="1">
				<p class="queryLabel">至:</p>
			</el-col>
			<el-col :span="4">
				<el-date-picker v-model="data.firstStarts" size="small" style="width:92%;" type="date" clearable placeholder="采购日期">
				</el-date-picker>
			</el-col>
			<el-col :span="1" style="">
				<p class="queryLabel">提单号:</p>
			</el-col>
			<el-col :span="3">
				<el-input placeholder="请输入提单号" style="width: 90%;" size="small" v-model="carSelect.orderNum">
				</el-input>
			</el-col>
			<el-col :span="1" style="text-align: left;margin-left: 15px;">
				<p class="queryLabel">VIN:</p>
			</el-col>
			<el-col :span="3">
				<el-input placeholder="请输入VIN" size="small" style="width: 88%; margin-left: 0px;" v-model="carSelect.vin">
				</el-input>
			</el-col>
			<el-col :span="1" style="text-align: left; margin-left: 0px;">
				<p class="queryLabel">打印状态:</p>
			</el-col>
			<el-col :span="3">
				<el-select size="small" style="width: 88%; margin-left: 3px;" v-model="carSelect.financeType" placeholder="请选择配置" >
					<el-option v-for="item in prientTypeCombo" :label="item.label" :value="item.value"></el-option>
				</el-select>
			</el-col>
		</el-row>
		<el-row>
	
			<el-col :span="22" style="padding-left: 0px;text-align: right">
				<el-button type="primary" size="small" v-on:click='query'>查 询</el-button>
				<el-button type="primary" size="small" @click="clean">清空查询条件</el-button>
				<el-button type="primary" size="small" @click="addPrient">加入打印列表</el-button>
				<el-button type="primary" size="small" v-on:click='prientOrder'>打印验车单</el-button>
				<!--<el-button type="primary" size="small" v-on:click='deleteCar'>删除车辆</el-button>-->
			</el-col>
		</el-row>
		<el-row>
			<el-col :span="24">
				<el-table :data="tableData.dataList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChange">
					<el-table-column type="selection" width="60">
					</el-table-column>
					<el-table-column prop="vin" label="VIN" width="180">
					</el-table-column>
					<!--<el-table-column prop="estimatePrice" label="暂估价格">
					</el-table-column>-->
					<el-table-column prop="carSeries" label="车系名称" width="100">
					</el-table-column>
					<el-table-column prop="purchaseDate1" label="采购日期" width="120">
					</el-table-column>
					<el-table-column prop="purchaseNum" label="采购单号" width="100">
					</el-table-column>
					<el-table-column prop="distributionStatus" label="配货状态" width="100">
					</el-table-column>
					<el-table-column prop="financeType" label="打印状态" width="100" :formatter="carPrientCov"><!--:formatter="carPrientCov"-->
					</el-table-column>
					<el-table-column prop="validateNum" label="打印次数" width="100">
					</el-table-column>
					<el-table-column prop="carModelCode" label="车型代码" width="100">
					</el-table-column>
					<el-table-column prop="modelName" label="车型名称" width="150">
					</el-table-column>
					<el-table-column prop="configureCode" label="配置代码" width="150">
					</el-table-column>
					<el-table-column prop="configureName" label="配置名称" width="150">
					</el-table-column>
					<el-table-column prop="carModelYear" label="车型年" width="100">
					</el-table-column>
					<el-table-column prop="appearanceCode" label="外观代码" width="100">
					</el-table-column>
					<el-table-column prop="appearanceName" label="外观颜色" width="120">
					</el-table-column>
					<el-table-column prop="trimCode" label="内饰代码" width="100">
					</el-table-column>
					<el-table-column prop="trimName" label="内饰名称" width="100">
					</el-table-column>
					<el-table-column prop="chooseCode" label="加装代码" width="100">
					</el-table-column>
					<el-table-column prop="chooseName" label="加装名称" width="100">
					</el-table-column>
					<el-table-column prop="distributionDate" label="配货日期" width="120">
					</el-table-column>
					<el-table-column prop="sendDate" label="发货日期" width="120">
					</el-table-column>
					<el-table-column prop="oldNum" label="提单号" width="100">
					</el-table-column>
					
				</el-table>
				<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
				</el-pagination>
			</el-col>
		</el-row>
		
		<!--<el-row>
				<el-col :span="22" style="padding-left: 0px;text-align: right">
					<el-button type="primary" size="small" v-on:click='deletePrientCar'>删除车辆</el-button>
				</el-col>
		</el-row>-->
		
		<!--++++++++++++++++++++++++++++++-->
		<el-dialog title="待打印车辆" v-model="prientFormShow" size="large" >
			<el-row>
				<el-col :span="22" style="padding-left: 0px;text-align: right">
					<el-button type="primary" size="small" v-on:click='deletePrientCar'>删除车辆</el-button>
				</el-col>
			</el-row>
			<el-table :data="prientList" border style="width: 100%;align-content: center;" @selection-change="handleSelectionChanges">
				<el-table-column type="selection" width="60">
				</el-table-column>
				<el-table-column prop="vin" label="VIN" width="180">
				</el-table-column>
				<el-table-column prop="carSeries" label="车系名称" width="100">
				</el-table-column>
				<el-table-column prop="purchaseDate1" label="采购日期" width="100">
				</el-table-column>
				<el-table-column prop="purchaseNum" label="采购单号" width="100">
				</el-table-column>
				<el-table-column prop="carModelCode" label="车型代码" width="100">
				</el-table-column>
				<el-table-column prop="modelName" label="车型名称" width="100">
				</el-table-column>
				<el-table-column prop="configureCode" label="配置代码" width="100">
				</el-table-column>
				<el-table-column prop="configureName" label="配置名称" width="100">
				</el-table-column>
				<el-table-column prop="carModelYear" label="车型年" width="100">
				</el-table-column>
				<el-table-column prop="appearanceCode" label="外观代码" width="100">
				</el-table-column>
				<el-table-column prop="appearanceName" label="外观颜色" width="100">
				</el-table-column>
				<el-table-column prop="trimCode" label="内饰代码" width="100">
				</el-table-column>
				<el-table-column prop="trimName" label="内饰名称" width="100">
				</el-table-column>
				<el-table-column prop="chooseCode" label="加装代码" width="100">
				</el-table-column>
				<el-table-column prop="chooseName" label="加装名称" width="100">
				</el-table-column>
				<el-table-column prop="distributionDate" label="配货日期" width="100">
				</el-table-column>
				<el-table-column prop="sendDate" label="发货日期" width="100">
				</el-table-column>
				<el-table-column prop="oldNum" label="提单号" width="100">
				</el-table-column>
				<el-table-column prop="distributionStatus" label="配货状态" width="100">
				</el-table-column>
				<el-table-column prop="financeType" label="打印状态" width="100" ><!--:formatter="financeTypef"-->
				</el-table-column>
			</el-table>
			<div slot="footer" class="dialog-footer">
				<el-button @click="prientFormShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='savePrient'>提 交</el-button>
			</div>
		</el-dialog>
		
		
		<el-dialog title="待打印车辆" v-model="printSecondsFormShow" size="large" >
		
			<div id="printHtml" style=" width: 100%;">
				<font face="宋体">
				<el-row>
					<div id="" style="float: left;width:33%;">
						4S店名称:&nbsp;{{companyName}}
					</div>
					
					<div id="" style="float: left;width: 33%;">
						物流公司:&nbsp;
					</div>
					
					<div id="" style="float: left;width: 34%;">
						{{this.$data.dateNow}}
					</div>
				</el-row>
				<!--
                	作者：1813180149@qq.com
                	时间：2017-08-18
                	描述：显示按照纸质验单做出第一版
                	第一次修改简化了验车单
                	第二次修改改为第一版
                -->
				<!--车牌号信息 开始-->
				<el-row style="padding-left:5px; margin-top:5px">
					<el-col :span="24">
						<div v-for="(mjlist,index) in prientList">	<!--mjlist赋值数据，index为索引-->
							<div v-if="(index)%5 == 0" style="height: 55px;"></div> <!--每5条数据间隔空白-->
							<table width="100%" border="1px solid #F9FAFC" cellspacing="0px" cellpadding="7px" bgcolor="#F9FAFC" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
								<tr>
									<td width="1%" rowspan="6"><b>{{index+1}}</b></td>
									<td width="13%" height="40px"><b>车辆名称/型号</b></td>
									<td width="20%">{{mjlist.carModel+'/'+mjlist.configure}}</td>
									<td width="30%" colspan="2">
										<div style="float: left;width: 50%">
											<b>发动机型号</b>{{mjlist.engineNum}}
										</div>
									</td>
									<td width="10%"><b>颜色</b></td>
									<td width="10%">{{(mjlist.appearanceName==null||mjlist.appearanceName=="")?mjlist.appearanceName:mjlist.appearanceName.substring(0,9)}}</td>
								</tr>
								<tr>
									<td ><b>车架号</b></td>
									<td >{{mjlist.vin}}</td>
									<td ><b>合格证号</b></td>
									<td ></td>
									<td colspan=""><b>出厂日期</b></td>
									<td ></td>
								</tr>
								<tr>
									<td ><b>全身漆面</b></td>
									<td colspan="2"></td>
									<td  colspan="2"><b>发动机工况</b></td>
									<td > </td>
								</tr>
								<tr>
									<td ><b>座椅内饰</b></td>
									<td colspan="2"><b></b></td>
									<td colspan="2"><b>全车风窗玻璃及灯罩</b></td>
									<td ><b></b></td>
								</tr>
								<tr>
									<td ><b>全车电器设备</b></td>
									<td colspan="2"><b></b></td>
									<td colspan="2"><b>全车附件</b></td>
									<td  ><b></b></td>

								</tr>
								<!--需求变更 ： 简化验车单-->
								<!--<tr>
									<td width="3%" rowspan="3"><b>{{index+1}}</b></td>
									<td width="19%"><b>vin</b></td>
									<td width="30%" >{{mjlist.vin}}</td>
									<td width="19%" ><b>车系/车型/配置</b></td>
									<td width="30%">{{mjlist.carSeries+'/'+mjlist.carModel+'/'+mjlist.configure}}</td>
								</tr>
								<tr>
									<td width="19%"><b>颜色</b></td>
									<td width="30%" >{{mjlist.appearanceName}}</td>
									<td width="19%" ><b>验车情况</b></td>
									<td width="30%"> </td>
								</tr>-->
						
								<!--<tr>
									configure
										carModel
										:
										carSeries
										:

									<td width="3%"><b>座椅内饰</b></td>
									<td width="5%" colspan="2"><b></b></td>
									<td width="3%" ><b>全车风窗玻璃及灯罩</b></td>
									<td width="3%" colspan="2"><b></b></td>
								</tr>
								<tr>
									<td width="3%"><b>全车电器设备</b></td>
									<td width="5%" colspan="2"><b></b></td>
									<td width="3%" ><b>全车附件</b></td>
									<td width="3%" colspan="2"><b></b></td>

								</tr>-->
								<tr>
									<td  colspan="6">
										<div>
											<b>备注：</b>
										</div>
									</td>
								</tr>
								
							</table>
						<div v-if="(index+1)%5 == 0" style="height: 40px;"></div> <!--每5条数据间隔空白-->
						</div>
						
					</el-col>
				</el-row>
				</font>
			</div>
			<div slot="footer" class="dialog-footer">
				
				<el-button type="primary" v-on:click='saveDayin'>打 印</el-button>
			</div>
		</el-dialog>
		<el-dialog title="待打印车辆" v-model="printSecondsFormShows" size="large" >
		
			<div id="printHtml" style=" width: 100%;">
				<font face="宋体">
				<!--
                	作者：1813180149@qq.com
                	时间：2017-11-22
                	描述：打印验车单-天众专用
                -->
				<!--车牌号信息 开始-->
				<el-row style="padding-left:5px; margin-top:5px">
					<el-col :span="24">
						<div >	<!--mjlist赋值数据，index为索引-->
							<table width="100%" border="1px solid #F9FAFC" cellspacing="0px" cellpadding="7px" bgcolor="#F9FAFC" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
								<tr v-for="(mjlist,index) in prientList">
									<td width="120"><b>{{mjlist.configureCode}}</b></td>
									<td width="120">{{mjlist.trimCode}}</td>
									<td width="120"></td>
									<td width="120">{{mjlist.estimatePrice}}</td>
									<td width="120">{{mjlist.appearanceName}}</td>
									<td width="120">{{mjlist.vin}}</td>
									<td width="120">{{mjlist.engineNum}}</td>
									<td width="120">提单</td>
									<td width="120">{{mjlist.distributionDate}}</td>
								</tr>
							</table>
						</div>
						
					</el-col>
				</el-row>
				</font>
			</div>
			<div slot="footer" class="dialog-footer">
				
				<el-button type="primary" v-on:click='saveDayin'>打 印</el-button>
			</div>
		</el-dialog>
		
		
		
		<carserice :show="showStart" v-if="showStart" v-on:close="showStart=false" v-on:insert="insert"></carserice>
	</div>
</template>
<script>
	import carserice from '../../insPlugins/carSeries.vue'
	import moment from 'moment'
	export default {
		data: function() {
			return {
				financeTypeF:"",
				vins:[],
				dateNow:"",
				six:false,
				mji:1,
				//待打印车辆
				prientFormShow: false,
				//打印二级界面
				printSecondsFormShow:false,
				//打印二级界面--天众
				printSecondsFormShows:false,
				//日期查询条件
				data: {
					firstStart: "",
					firstStarts: ""
				},
				//页码数
				CurentPage: 1,
				//每页的数量
				page: this.page,
				//仓库类型下拉
				warehouseType: [],

				//合格证状态
				certificateStatusCovertData: {},

				//车辆销售状态下拉
				saleType: [{
					label: '采购入库',
					value: '0'
				}, {
					label: '调拨入库',
					value: '3'
				}, {
					label: '销售退车入库',
					value: '2'
				}],

				//页码数
				CurentPage: 1,
				//每页的数量
				page: this.page,
				//公司数据
				tableData: {
					total: 0,
					dataList: []
				},

				condition: {
					enterType: "",
					carModel: "",
					wareHouse: "",
					enterTimeStart: "",
					enterTimeStop: "",
				},
				//查询条件
				carSelect: {
					//车辆状态 
					status: "0",
					//初次入库起
					purchaseStartDate:"",
					//初次入库止
					purchaseStopDate:"",
					//车系代码
					carSeriesCode: "",
					//车型代码 
					carModelCode: "",
					//配置代码
					carConfigureCode: "",
					//仓库
					warehouse: "",
					//vin
					vin: "",
					//打印状态
					financeType: "0",
					//提单号
					orderNum: "",
				},
				//查询条件初始值
				carSelectS: {
					//车辆状态 
					status: "0",
					//初次入库起
					purchaseStartDate:"",
					//初次入库止 
					purchaseStopDate:"",
					//车系代码
					carSeriesCode: "",
					//车型代码 
					carModelCode: "",
					//配置代码
					carConfigureCode: "",
					//仓库
					warehouse: "",
					//vin
					vin: "",
					//打印状态
					financeType: "0",
					//提单号
					orderNum: "",
				},
				//warehouseFormShow: false,
				//校验规则
				Rule: {

				},
				//列表的选择车辆
				multipleSelection: [],
				//打印的选择车辆
				multipleSelections: [],
				companyId: "",

				//树形图查询条件
				dictTreeSearchValue: "",
				paramTreeData: [],
				//树型数据配置
				defaultProps: {
					children: 'child',
					label: 'label',
				},
				showStart: false,
				//选中的类型（车型/车系）
				carType: '',
				//选择的车辆信息
				datalabel: '',
				datavale: '',
				//车型名称
				carModelName: "",
				//车型名称
				carModelCode: "",
				//配置的下拉
				configCombo: [],
				//车型的下拉
				modelCombo: [],
				//打印状态的下拉
				prientTypeCombo: [{
					label: '未打印',
					value: '0'
				}, {
					label: '已打印',
					value: '1'
				}, ],
				//待打印的列表
				prientList: [],
				//4s店
				companyName:"",
			}
		},
		methods: {
			//从待打印的车辆里删除
			deletePrientCar: function() {
				debugger;
				if(this.$data.multipleSelections.length == 0) {
					this.$message("请选择要删除的车辆");
				} else {
					//根据vin判断，防止重复添加
					for(var i = 0; i < this.$data.multipleSelections.length; i++) {
						for(var j = 0; j < this.$data.prientList.length; j++) {
							if(this.$data.multipleSelections[i].vin = this.$data.prientList[j].vin) {
								//从打印列表中移除角标为j的元素（后面的角标会改变）
								this.$data.prientList.splice(j, 1);
								break;
							}
						}
					};
					this.$message("已从列表中删除");
				}

			},
			//点击打印
			saveDayin:function(){
				debugger;
				var vins = [];
				for(var i = 0; i < this.$data.prientList.length; i++) {
							vins[i] = this.$data.prientList[i].vin
						};
						
				this.$http.post(this.API_ROOT+'/scm/car/printNumber',vins)
				.then((response) => {
					this.query();
				});
				
				this.$data.prientFormShow = false;
				this.$data.printSecondsFormShow = false;
				this.$data.printSecondsFormShows = false;
				this.$data.prientList=[];
				var newstr = document.getElementById("printHtml").innerHTML;
				var printWindow = window.open();
				printWindow.document.body.innerHTML = newstr;
				printWindow.print();
				printWindow.close();
			},
			//打印车辆
			savePrient: function() {
				//this.$data.dateNow = new Date().format('yyyy年MM月dd日');
				if(this.$data.prientList.length < 1) {
					this.$message.error("请选择车辆");
				} else {
					this.$confirm('确认要打印吗?', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						var data = [];
						for(var i = 0; i < this.$data.prientList.length; i++) {
							data[i] = this.$data.prientList[i].vin
							//vins[i] = this.$data.prientList[i].vin
						};
						//debugger;
						this.$http.post(this.API_ROOT + '/scm/enterWarehouse/printValidate', data, {
							params: {}
						}).then((response) => {
							this.$message(response.data.msg);
							this.query();
						}, (response) => {});
						//如果是天众的打开专用的打印格式页面
						debugger;
						if( window.localStorage.getItem("companyId")=="8a1029015b612d40015b6142c2a50470")
						{
							this.$data.printSecondsFormShows = true;
						}else{
						this.$data.printSecondsFormShow = true;
						}
						this.$data.dateNow = this.moment(new Date()).format("YYYY年MM月DD日");
						
					
					}).catch(() => {
						this.$message({
							type: 'info',
							message: '已取消此操作'
						});
					});
				}
			},
			
			//加入待打印列表
			addPrient: function() {
				debugger;
				if(this.$data.prientList.length == 0) {
					this.$data.prientList = this.$data.multipleSelection.slice(0);
				} else {
					//根据vin判断，防止重复添加
					for(var i = 0; i < this.$data.multipleSelection.length; i++) {
						for(var j = 0; j < this.$data.prientList.length; j++) {
							if(this.$data.multipleSelection[i].vin == this.$data.prientList[j].vin) {
								//从multipleSelection中移除角标为i的元素
								this.$data.multipleSelection.splice(i, 1);
								i--;
								break;
							}
						}
					};
					debugger;
					this.$data.prientList = this.$data.prientList.concat(this.$data.multipleSelection);
					//this.$data.multipleSelection = [];
					/*********************************/
					debugger;
				}
				this.$message("已加入列表");
			},
			//清空查询条件
			clean: function() {
				this.$data.data.firstStart="";
				this.$data.data.firstStarts="";
				this.$data.carSelect = Object.assign(this.$data.carSelect, this.$data.carSelectS);
				this.$data.carModelCode = "";
			},
			//车型改变的回调
			changeModel: function(val) {
				if(val != "") {
					this.comboConfigure(val);
				}
				debugger;
			},
			//车系选择的回调
			insert: function(val, lable) {
				debugger;
				this.$data.carSelect.carSeriesCode = val;
				this.$data.carModelCode = lable;
				this.$http.get(this.API_ROOT + '/base/carModel/combo', {
					params: {
						seriesId: val
					}
				}).then((response) => {
					debugger;
					this.$data.modelCombo = response.data;
					this.$data.carSelect.carModelCode = "";
					this.$data.carSelect.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});

			},
			//选择车型后的回调
			comboConfigure: function(val) {
				this.$http.get(this.API_ROOT + '/base/carConfigure/combo', {
					params: {
						modelId: val
					}
				}).then((response) => {
					debugger;
					this.$data.configCombo = response.data;
					this.$data.carSelect.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});
			},
			//打开车型车系选择
			handleIconClick: function() {
				this.$data.showStart = true;
			},
			//打印验车单
			prientOrder: function() {
				this.$data.prientFormShow = true;
			},
			//销售状态转换
			carPrientCov: function(row, column) {
				return row.financeType == "0" ? '未打印' : '已打印';
			},

			//合格证状态转换
			certificateStatusCov: function(row, column) {
				return this.$data.certificateStatusCovertData[row.certificateStatus];
			},

			certificateStatusCovert: function() {
				this.$http.get(this.API_ROOT + '/base/dict/convert', {
					params: {
						group: "scmCertificateStatus"
					}
				}).then((response) => {
					this.$data.certificateStatusCovertData = response.data;
				}, (response) => {});
			},
			//仓库类型转换
			warehouseTypeCov: function(row, column) {
				return row.warehouseType == "0" ? '虚拟库' : '实体库';
			},

			//财务归属类型转换
			carFinancialBelongCov: function(row, column) {
				return row.financialBelong == "0" ? '本店' : '非本店';
			},
			//打开车型车系选择
			handleIconClick: function() {
				this.$data.showStart = true;
			},
			//查询树节点
			searchTree: function() {
				if(this.$data.dictTreeSearchValue == "") {
					this.$message("请输入查询条件");
					this.queryParamTree();
					return;
				}
				this.$refs.dictTree.filter(this.$data.dictTreeSearchValue);
			},
			//点击资源树节点
			handleNodeClick(data) {
				debugger;
				this.$data.carType = data.type;
				this.$data.datalabel = data.label;
				this.$data.datavale = data.value;
			},
			//查询参数树
			queryParamTree: function() {
				//获取资源树
				debugger;
				this.$http.get(this.API_ROOT + '/base/car/tree', {}).then((response) => {
					this.$data.paramTreeData = response.data;
				}, (response) => {});
			},
			//资源过滤
			filterNode: function(value, data, node) {
				if(!value) return true;
				return data.label.indexOf(value) !== -1;
			},

			//选择框
			handleSelectionChange: function(val) {
				debugger;
				this.$data.multipleSelection = val;
			},
			//打印车辆的选择框
			handleSelectionChanges: function(val) {
				debugger;
				this.$data.multipleSelections = val;
			},


			//查询销售车辆
			query: function() {
				debugger;
				this.$data.carSelect.purchaseStartDate = this.momentFu(this.$data.data.firstStart);
				this.$data.carSelect.purchaseStopDate = this.momentFu(this.$data.data.firstStarts);
				this.$http.post(this.API_ROOT + '/scm/car/carMIGO', this.$data.carSelect, {
					params: {
						status:this.$data.carSelect.status,
						start: this.$data.CurentPage,
						limit: this.$data.page.pageSize,
						
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						// es5写法
						this.$data.tableData = resp.data;
						//this.baseQuery(this.$data.curTreeDeptId);
						//this.$data.exFormShow = false;
					} else {
						//debugger;
						this.$message.error(resp.data.msg);
					}
				}, resp => {});
				debugger;
			},
			//时间判断为空的封装
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},
			//列表，分页大小切换
			handleSizeChange: function() {},
			//列表,当前页切换
			handleCurrentChange: function(currentPage) {
				this.$data.CurentPage = currentPage;
				//this.$data.dictGroup = '';
				this.query();
			},
		},
		financeTypef:function(temp){
			var t = "";
			switch (temp){
				case 0:
				t = "未打印";
				break;
				
				default:
				t = "已打印";
				break;
			}
			return t;
		},
		//表单创建时执行
		created: function() {
			this.$data.companyName=window.localStorage.getItem("companyName");
			this.query();
			this.certificateStatusCovert();

			//查找车型
			this.queryParamTree();

			//获取仓库类型下拉
			this.$http.get(this.API_ROOT + '/scm/warehouse/combo', {
				params: {
					group: "warehouse"
				}
			}).then((response) => {
				this.$data.warehouseType = response.data;
			}, (response) => {});

			//获取车辆销售状态下拉
			//			this.$http.get(this.API_ROOT + '/base/dict/combo', {
			//				params: {
			//					group: "scmCarSaleStatus"
			//				}
			//			}).then((response) => {
			//				this.$data.saleType = response.data;
			//			}, (response) => {});

		},
		components: {
			carserice
		},
	}
</script>
<style>
	.el-table .info-row {
		height: 10px !important;
	}
	
	.item {
		width: 30px;
	}
	
	.el-form-item {
		clear: both;
	}
	
	.el-dropdown .el-button-group,
	.el-table .el-tooltip,
	.el-table .el-tooltip__rel {
		display: inline;
	}
	
	.el-table {
		height: 100%;
		width: 100%;
	}
	
	#el-select {
		width: 200px;
	}
</style>